@contentful/field-editor-markdown 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-markdown@1.1.9...@contentful/field-editor-markdown@1.1.10) (2023-01-27)
7
+
8
+ ### Bug Fixes
9
+
10
+ - mail to links replace ampersand [TOL-923] ([#1331](https://github.com/contentful/field-editors/issues/1331)) ([8e3d5df](https://github.com/contentful/field-editors/commit/8e3d5df5105a48126a790b8c341139fe7cf11d72))
11
+
6
12
  ## [1.1.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-markdown@1.1.8...@contentful/field-editor-markdown@1.1.9) (2022-12-08)
7
13
 
8
14
  **Note:** Version bump only for package @contentful/field-editor-markdown
@@ -25,8 +25,8 @@ var min = _interopDefault(require('lodash/min'));
25
25
  var max = _interopDefault(require('lodash/max'));
26
26
  var times = _interopDefault(require('lodash/times'));
27
27
  var repeat = _interopDefault(require('lodash/repeat'));
28
- var Markdown = _interopDefault(require('markdown-to-jsx'));
29
28
  var DOMPurify = _interopDefault(require('dompurify'));
29
+ var Markdown = _interopDefault(require('markdown-to-jsx'));
30
30
  var inRange = _interopDefault(require('lodash/inRange'));
31
31
  var isObject = _interopDefault(require('lodash/isObject'));
32
32
  var extend = _interopDefault(require('lodash/extend'));
@@ -1886,6 +1886,14 @@ var openCheatsheetModal = function openCheatsheetModal(dialogs) {
1886
1886
  });
1887
1887
  };
1888
1888
 
1889
+ // This code will replace '&' with '&' only inside the href attribute of the mailto link.
1890
+ // Otherwise the mailto link will not work correctly
1891
+ var replaceMailtoAmp = function replaceMailtoAmp(string) {
1892
+ return string.replace(/href="mailto:[^"]*&/g, function (match) {
1893
+ return match.replace(/&/g, '&');
1894
+ });
1895
+ };
1896
+
1889
1897
  var _excluded$2 = ["Embedly", "children"];
1890
1898
 
1891
1899
  var _templateObject$1;
@@ -1932,7 +1940,7 @@ var MarkdownPreview = /*#__PURE__*/React__default.memo(function (props) {
1932
1940
  // https://github.com/cure53/DOMPurify/blob/main/src/tags.js#L3-L121
1933
1941
 
1934
1942
  var cleanHTML = React__default.useMemo(function () {
1935
- return DOMPurify.sanitize(props.value);
1943
+ return replaceMailtoAmp(DOMPurify.sanitize(props.value));
1936
1944
  }, [props.value]);
1937
1945
  return React__default.createElement("div", {
1938
1946
  className: className,